/*
 * test_evbuffer.cpp
 *
 *  Created on: Jun 27, 2014
 *      Author: killerg
 */


#include <stdio.h>
#include <event2/buffer.h>
#include <stdlib.h>

bool test_evbuffer() {
	auto buff = evbuffer_new();
	evbuffer_add_printf(buff, "hello world");
	size_t size = 0;
	auto ln = evbuffer_readln(buff, &size, EVBUFFER_EOL_ANY);
	if (ln) {
		printf("%s\n", ln);
		free(ln);
	}
	evbuffer_add_printf(buff, "\n");
	ln = evbuffer_readln(buff, &size, EVBUFFER_EOL_ANY);
	if (ln) {
		printf("%s\n", ln);
		free(ln);
	}
	evbuffer_free(buff);

	return true;
}
